// Author: wsfuyibing <682805@qq.com>
// Date: 2025-06-12

package kind

// TicketMode
// 作钓场次.
type TicketMode int

const (
	_ TicketMode = iota

	TicketModeSingle
	TicketModeRepeat
)

var (
	ticketModeTexts = map[TicketMode]string{
		TicketModeSingle: "单场",
		TicketModeRepeat: "多场",
	}
	ticketModeUndefined = "错误"

	ticketModeFlags = map[TicketMode]string{
		TicketModeSingle: "single",
		TicketModeRepeat: "repeat",
	}
	ticketModeUnknownFlag = "unknown"
)

func TicketModeDict() []map[string]any {
	var res = make([]map[string]any, 0)
	for _, v := range []TicketMode{
		TicketModeRepeat,
		TicketModeSingle,
	} {
		res = append(res, map[string]any{
			"Key":   v,
			"Value": v.Text(),
		})
	}
	return res
}

func (o TicketMode) Flag() string {
	if str, ok := ticketModeFlags[o]; ok {
		return str
	}
	return ticketModeUnknownFlag
}

func (o TicketMode) IsSingle() bool { return o == TicketModeSingle }
func (o TicketMode) IsRepeat() bool { return o == TicketModeRepeat }

func (o TicketMode) Text() string {
	if str, ok := ticketModeTexts[o]; ok {
		return str
	}
	return ticketModeUndefined
}
